package com.fjwt.gz.service.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjwt.gz.db.dto.ScoreRecordDTO;
import com.fjwt.gz.db.entity.ScoreRecord02Entity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 会员积分领取记录明细表（每条记录相当于1积分） Mapper 接口
 * </p>
 *
 * @author shiyonghao
 * @since 2025-04-09
 */
public interface ScoreRecord02Mapper extends BaseMapper<ScoreRecord02Entity> {

    /**用户主动消耗积分时查询过期积分list**/
    List<ScoreRecordDTO> selectOffRecordList(@Param("fansId") Long fansId, @Param("overDate") String overDate, @Param("scoreNeed") Integer scoreNeed);

    /**
     * 过期积分明细更新状态
     * @param offScoreRecords
     */
    void updateBatchOffScore(@Param("resList") List<ScoreRecordDTO> offScoreRecords, @Param("state")Integer state, @Param("fansId")Long fansId);

    /**
     * 定时任务过期积分查询
     * @param overDate
     * @param state
     * @return
     */
    IPage<ScoreRecordDTO> selectOffRecordListOfTask(Page page, @Param("overDate") String overDate, @Param("state") Integer state);

}
